-
Notifications
You must be signed in to change notification settings - Fork 0
LedFeedbackClass fix led pin not initialized #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #22 +/- ##
=======================================
Coverage 90.27% 90.27%
=======================================
Files 7 7
Lines 720 720
Branches 86 86
=======================================
Hits 650 650
Misses 70 70 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Memory usage change @ 8fef0c7
Click for full report table
Click for full report CSV
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug where an uninitialized LED pin was causing an OPTA relay to malfunction by continuously turning on and off. The fix ensures proper pin initialization and validation before LED operations.
- Initialize LED pin with an invalid value and validate before operations
- Turn off the LED when NONE mode is selected instead of during updates
- Change LED pin type from uint16_t to int to support negative invalid value
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/utility/LEDFeedback.h | Adds invalid pin constant, changes pin type to int, and initializes with invalid value |
src/utility/LEDFeedback.cpp | Adds pin validation checks and moves LED off logic to mode selection |
uint32_t* _framePtr = nullptr; | ||
int32_t _ledChangeInterval = 500; | ||
int32_t _ledChangeInterval = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the default value of _ledChangeInterval from 500 to 0 may have unintended side effects. The original value of 500 appears to be a meaningful default interval, and setting it to 0 could affect existing behavior where this interval is expected to have a non-zero value.
int32_t _ledChangeInterval = 0; | |
int32_t _ledChangeInterval = 500; |
Copilot uses AI. Check for mistakes.
why not checking for |
Because it's equivalent, but if it's not clear I will update the code. Edit: updated for checking the mode |
Memory usage change @ f20103f
Click for full report table
Click for full report CSV
|
Issue
It has been reported a malfunction of the OPTA relay number 1 that was continously turning on and off.
The device was running a Cloud Sketch 2.0 with the NetworkConfigurator enabled.
After investigation the problem was found on a not properly initialization of the pin for the feedback led when no feedback mode is selected.
Changes
_ledPin
with an invalid value and check its value before setting itON
orOFF
NONE
is selected